#include "gdn/Sprite.h"

#include "gdn/Utility.h"

namespace gdn
{
	void Sprite::SetImage( Image& theImage )
	{
		sprite.SetImage( theImage.image );
		image = &theImage;
	}

	const Image& Sprite::GetImage() const
	{
		return ( * image );
	}

	void Sprite::Move( float theX, float theY )
	{
		sprite.Move( theX, theY );
	}

	void Sprite::Move( const Vector2f& thePos )
	{
		sprite.Move( thePos.x, thePos.y );
	}

	void Sprite::SetPosition( float theX, float theY )
	{
		sprite.SetPosition( theX, theY );
	}

	void Sprite::SetPosition( const Vector2f& thePos )
	{
		SetPosition( thePos.x, thePos.y );
	}

	Vector2f Sprite::GetPosition() const
	{
		return ConvertToGdn< float >( sprite.GetPosition() );
	}

	void Sprite::SetRotation( float degrees )
	{
		sprite.SetRotation( degrees );
	}

	float Sprite::GetRotation() const
	{
		return sprite.GetRotation();
	}

	void Sprite::SetScale( float theX, float theY )
	{
		sprite.SetScale( theX, theY );
	}

	void Sprite::SetScale( const Vector2f& theScale )
	{
		SetScale( theScale.x, theScale.y );
	}

	Vector2f Sprite::GetScale() const
	{
		return ConvertToGdn< float >( sprite.GetScale() );
	}

	void Sprite::SetSubRectangle( int theX, int theY, int theWidth, int theHeight )
	{
		sprite.SetSubRect( sf::IntRect( theX, theY, theWidth, theHeight ) );
	}

	void Sprite::SetSubRectangle( const Vector2i& thePos, const Vector2i& theSize )
	{
		SetSubRectangle( thePos.x, thePos.y, theSize.x, theSize.y );
	}

	void Sprite::SetSubRectangle( const Rectanglei& theRectangle )
	{
		SetSubRectangle( theRectangle.x, theRectangle.y, theRectangle.width, theRectangle.height );
	}

	Rectanglei Sprite::GetSubRectangle() const
	{
		return ConvertToGdn< int >( sprite.GetSubRect() );
	}

	void Sprite::SetOrigin( float theX, float theY )
	{
		sprite.SetOrigin( theX, theY );
	}

	void Sprite::SetOrigin( const Vector2f& theOrigin )
	{
		SetOrigin( theOrigin.x, theOrigin.y );
	}

	Vector2f Sprite::GetOrigin() const
	{
		return ConvertToGdn< float >( sprite.GetOrigin() );
	}
}
